﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Windows.Forms;

namespace MainProgram
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }
        //更新下
        private void button1_Click(object sender, EventArgs e)
        {

            string path = System.Environment.CurrentDirectory;
            string fileName = "RPCenter.Updater.exe";

            Process proc = new Process();
            proc.StartInfo.UseShellExecute = true;//是否使用操作系统外壳程序启动进程 
            proc.StartInfo.WorkingDirectory = path;//启动进程的初始目录
            proc.StartInfo.FileName = fileName;
            proc.Start();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ServiceController serviceController1 = new ServiceController();
            serviceController1.ServiceName = textBox1.Text;
            serviceController1.MachineName = ".";

            if (serviceController1.Status == ServiceControllerStatus.Running)
                serviceController1.Stop();
            else
                serviceController1.Start();
        }
    }
}
